Copyright: Trayer Help written by Ng KimFatt (c) 1998


About Trayer

Trayer documentation (version 2.3.0)

© Ng KimFatt 1998

THERE IS NO WARRANTY FOR THIS PROGRAM. Please check out the Disclaimer section of this document.

1. Introduction

2. Installation

3. Uninstallation

4. Running

5. Feedback

6. History

7. Disclaimer

1. Introduction

Originally designed just to run applications and add icons to the System Tray area representing their presence, Trayer has since been added some nice-to-have features. Just to name a few, "Application Launcher Mode", "Auto Update Tray Icon", "Auto Hide Tray Icon", and also the ability to remove the Taskbar button of the target application. Ideal for programs such as WinPopup, CD Player, or any background processing programs that you want to keep running without taking up any Taskbar space.

2. Installation

If you have previous version of Trayer installed on your PC, please remove it first before you perform the following steps. To remove the previous version of Trayer, please refer to "Uninstallation" section below.

I) Create a temporary folder for the installation:

Right-click on the desktop and choose New:Folder from the pop-up menu. Name the folder "Temp".

II) Download the Trayer:

Click the link on the Trayer page to download the file "Trayer.zip". Save it in the Temp folder you just created.

III) De-compress the file "Trayer.zip":

Open the Temp folder and unzip the file "Trayer.zip". This will create several new files in your Temp folder.

IV) Install the Trayer:

Find the new file called "Trayer.inf". Right-click it, then choose Install.

This will copy the following files into the respective folders:

Trayer.exe & Trayer.dll	->	Windows directory

Trayer.inf	->	INF directory

Trayer.cnt & Trayer.hlp	->	Help directory

Okay okay… I know you don’t like the program to be copied into Windows directory, I don’t like it either, but this is the easiest way so that it can be run from any directory.

V) Remove Temp folder:

Delete the Temp folder (and all the files) in it from the desktop.

3. Uninstallation

Please make sure you do not have Trayer running before you perform the following steps…

I) Open the control panel:

On the Start Menu, choose Settings->Control Panel.

II) Open "Add/Remove Programs":

Find the Control Panel called Add/Remove Programs and double-click it.

III) Remove Trayer:

Select “Trayer (Remove Only)” on the list, then click the button marked "Add/Remove".

4. Running

Run Trayer.exe to configure the target application. Then, click “Create Shortcut” button to save the configuration of the target application as a shortcut, so that the next you want to run it, you can just double-click on the shortcut and have the target application run in the tray without going through the configuration steps all over again.

After running the program, click the icon in the system tray to show or hide the window of the target application. It also can be configured to activate by double-click instead of single-click.

Right-click the icon to bring up the context menu, which allows you to change some parameters of the running instance of Trayer, or to configure Trayer with new programs and create shortcuts.

Context-sensitive help is supported in the dialog box, though it should be intuitive enough.

To re-configure a Trayer shortcut, double-click the shortcut while holding down the Shift key. The Trayer Properties dialog will be displayed. After making the changes, click “Create Shortcut” button and save the shortcut with the same filename to overwrite it.

The alternative of making changes to an existing Trayer shortcut is to run Trayer first, and then drag-and-drop the Trayer shortcut from Windows Explorer to the Trayer Properties dialog box. By doing this, the "Create Shortcut" button will then become "Save Shortcut", as such, you can click the "Save Shortcut" button to save and overwrite the shortcut that you have just dropped more easily.

As you may notice, drag-and-drop support is added to Trayer Properties dialog box. You can also drag-and-drop executables or document files to the Properties dialog box.

You can also create a shortcut to Trayer.exe and put the shortcut on the desktop, just that I personally think that it wouldn’t be very much useful, as you don’t normally run Trayer by itself. One way of using it is, you can actually drop an executable or a document to the shortcut from windows explorer to have it run right away.

5. Feedback

Please send in your opinions, bug reports, suggestions, etc, to me. I can be reached at ngkf@pacific.net.sg

6. History

04/08/1998 - 2.3.0

1. Fixed bug that doesn't show the menu and toolbars in Excel 97 when Excel 97 is minimized and then shown by Trayer.

2. Fixed bug that fails to interpret the command line correctly if the command line consists of hyphen "-" characters.

3. Fixed bug that fails to update the tray icon and tooltip under certain circumstances.

4. Fixed bug that overwrites the memory mapped file causing 2 or more Trayer programs running concurrently to be failed under a very rare circumstance.

5. Added "Remember Preference" option to remember user's preference. At this point, only the default folder for saving Trayer shortcuts is remembered. Any other suggestions?

6. Added "Force Target as Single Instance Application" option. Also the command line parameter "/single".

7. Added function to bring up the System Menu of the target application by holding down Shift key while right-clicking the tray icon.

8. Added option "Might be a Child Window itself" under "Target Window" in Properties dialog box. Also the command line parameter "/child".

9. Polished the Error Message dialog box to give suggestions what to do when error occurs.

10. Modified the About dialog box to include the link to the Trayer home page.

13/07/1998 - 2.2.1

1. Fixed bug that fails to update the tray icon and tooltip under certain circumstances.

12/07/1998 - 2.2.0

1. Fixed bug that removes double-quotes from the command line unnecessarily.

2. Fixed bug that overwrites the memory mapped file causing 2 or more Trayer programs running concurrently to be failed.

3. Fixed bug that overwrites the Timeout timer causing 2 or more Trayer programs running concurrently to be failed.

4. Fixed bug that causes "Hide On Minimize" function inoperative when 2 or more Trayer programs are launched concurrently. The same bug also prevents Trayer from removing the icon in the system tray when the target program is terminated.

5. Added "Application Launcher" feature. Also the command line parameter "/launcher".

6. Added new command line parameter "/run" that runs target application in normal window, minimized or maximized.

7. Added "Auto Update Tray Icon" feature. Also the command line parameter "/updateicon".

8. Command line parameter "/hidetrayer" should be replaced by "/hideicon" and is provided for backward compatibility only.

9. Modified Exit command in the context menu to send SC_CLOSE to target application only instead of closing down Trayer without knowing that the target application is actually terminated. To force Trayer to close down, press and hold SHIFT key while selecting Exit.

10. Modified the error message displayed when the target window (with the caption specified by the user) cannot be located.

11. Modified the show/hide toggle behaviour to bring the target window to top instead of hiding it if the target window is shown and inactivated (for "Taskbar Button Always Hide" only).

07/06/1998 - 2.1.0

1. Fixed bug that shuts down the system when the execution timeout occurs while more than one Trayer target is running.

2. Fixed bug that interprets double-quotes in the command line wrongly.

3. Fixed bug that posts WM_CLOSE to child windows and causes illegal operation fault.

4. Fixed bug that locates hidden window as target window.

5. Fixed bug that adds double-quotes to the command line unnecessarily.

6. Fixed bug that disallows execution of shortcuts when shortcuts are passed in as command line parameters.

7. Added code to determine whether target program is written as a single instance program, so that error message will not be displayed if the second instance of the target program is executed and subsequently terminated. Instead, Trayer will try to switch to the first instance of the target program.

8. Added code to display error message if Trayer.DLL cannot be loaded (eg. File not found). In this case, taskbar button "Always Hide" feature will not be functioning.

24/05/1998 - 2.0.0

1. Call SetMenuDefaultItem() to bold default menu item.

2. Added Hotkey support to context menu.

3. Added new "Auto Hide Trayer Icon" to Properties dialog box. This feature removes icon in the System Tray automatically when the target window is shown.

4. Replaced "Hide On Minimize" in Properties dialog box with "Hide Taskbar Button".

5. Added "Always Hide" to "Hide Taskbar Button" in Properties dialog box.

6. Added new command line parameter "/hidetrayer", "/hidebutton" and "/target".

7. Command line parameter "/hideonmin" should be replaced by "/hidebutton" and is provided for backward compatibility only.

8. Added Clist to keep track the windows show mode, fixed bug that show hidden parent window of the target window unnecessarily.

9. Added radio buttons in Properties dialog box to select the Target Window type.

10. Added code to find alternative window in the same process of the target window when target window is destroyed. This behaviour is determined by the Target Window type.

11. Added code to show/hide the target window and all its child windows. This behaviour is determined by the Target Window type.

12. Added code to show/hide all the windows in the same process of the target window. This behaviour is determined by the Target Window type.

13. Added code to send WM_CLOSE to all the child windows of the target window then finally the target window.

14. Command line parameters which has default value will no longer be saved into the shortcut. This is to solve command line parameters too long problem.

15. Added dialog box icon for Properties dialog box and Target Program Info dialog box.

16. Added "Auto Refresh" to update Program Info dialog box automatically.

17. Added "Always On Top" to keep Program Info dialog box always on top of other windows.

18. Modified Properties dialog box into PropertySheet with "General" page and "Advanced Settings" page.

19. Separated hook functions from Trayer.exe to Trayer.dll for taskbar button "Always Hide" feature.

20. Added Drag & Drop support to accept files drop into Properties dialog box.

21. Changed default icon file to SHELL32.DLL instead of PIFMGR.DLL.

22. Redesign Trayer to run as single instance program.

23. Added awareness of environment strings in command line, e.g. %SystemRoot% for Windows NT.

24. Added awareness of Prefix "Shortcut to" setting in TWEAKUI.

25. Added "Browse" button to select folder for "Start in" parameter in Properties dialog box.

26. Added "Icon chooser" dialog box in Properties dialog box. Thanks Victor Vogelpoel from Netherlands for sending me the code, which is written by PJ Naughter.

27. Fixed bug of TrackPopupMenu(), whereby the context menu appears when clicked and immediately disappears by itself.

28. Fixed bug that terminates Trayer when the target program terminates itself after executing another program, even if "Window Name/Caption" is specified.

29. Fixed bug that changes icon in the Properties dialog unnecessarily.

30. Fixed bug that shows incorrect value of Process ID and Thread ID in Program Info dialog box.

31. Fixed bug that shows Properties dialog box as minimized or maximized when shift-double-clicking the shortcut (if the shortcut is configured to run as minimized or maximized).

32. Fixed bug that targeted wrongly on an existing window as the target window which caption happens to match the "Window Name/Caption" specified.

33. Fixed bug that interprets executable filename wrongly as a command line argument.

12/04/1998 - 1.0.0

Initial Release.

7. Disclaimer

This software can be used freely for any purpose. It can be distributed freely, as long as it is not sold commercially without permission from the Author.

This Software is provided on an “AS IS” basis, without warranty of any kind, neither express nor implied. The entire risk as to the quality and performance of the Software is borne by you. Should the Software prove to be defective, you and not the Author assume the entire cost of any service and repair.

Ng KimFatt (ngkf@pacific.net.sg)

4th August 1998


Trayer Command Line Parameters

Usage:	Trayer.exe "target program" [options]

Options Summary:

/cmdline= the command line arguments that you want to pass to the target program at startup. (See Important Note)

/icon= the name of the file that contains the icon to be shown in the system tray, followed by an optional comma and the icon index number.

/click=	1=single-click toggle show/hide

2=double-click toggle show/hide

/hidebutton=	0=don't hide

1=hide on minimize

2=always hide

/hideicon=  Auto Hide Tray Icon
0=no
1=yes

/updateicon= Auto Update Tray Icon
0=no

1=yes

/caption= the name of the window, also known as caption or window title. You need to enter this option only if you have problem running the target program without entering this. (See Important Node)

/matchall= whether the string entered in “Window Name/Caption” field is to be matched against the full window caption or partial window caption.
0=no

1=yes

/tmeout= the time Trayer waits for the window of the target application to appear (in milliseconds)

/child= whether the target window itself is a child window created by a hidden parent window.
0=no

1=yes

/target=	Target Window Type

0=First Located Window

1=First Located Window and Childs

2=All Windows Associated to the Process

/launcher= Application Launcher Mode

0=no

1=yes

/run= how the window is displayed when you start this program.

0=Normal window

1=Minimized window

2=Maximized window

/single= Force Target as Single Instance Application

0=no

1=yes

Important Note:

1.	Enclose parameter values that have embedded spaces with double-quotes.

Example:

Original:

Notepad.exe "C:\My Documents\Letter.txt"

With Trayer:

Trayer.exe Notepad.exe /cmdline="C:\My Documents\Letter.txt"

2.	Replace parameter values that have embedded double-quotes with two continuos single-quotes.

Example:

Original:

Outlook.exe /profile "My Profile"

With Trayer:

Trayer.exe Outlook.exe /cmdline="/profile ''My Profile''" /target=2

Close-up:

Trayer.exe Outlook.exe /cmdline=(double-quote)/profile (single quote)(single quote)My Profile(single quote)(single quote)(double quote) /target=2


Trayer Properties Dialog

Create Shortcut Button

General

Target Program

Filename

Filename Browse

Parameters

Start In

Start In Browse

Run

Auto Resolve Association

Icon

Icon Filename

Icon Filename Browse

Icon Index

Behaviour

Show/Hide Toggle

Hide Taskbar Button

Auto Hide Tray Icon

Auto Update Tray Icon

Advanced Settings

Target Window

Window Name/Caption

Caption Match All

Execution Timeout

Target Window Type

First Located Window

First Located Window and Childs

All Windows Associated To The Process

Advanced Behaviour

Application Launcher Mode

Launch at Startup


Program Information Dialog
Program Info Dialog

Command Line

Window Name/Caption

HWND

HINSTANCE

Process ID

Thread ID

Auto Refresh

Always On Top


The command line of the target application.


The text in the window caption.


The unique ID of the target window.


The instance handle of the target application. Instance handles are not unique.


The ID of the process that owns the thread that created this window.


The ID of the thread that created this window.


Auto refresh and update the information in this dialog box at one second interval.


Keep this dialog box always visible and on top of other windows.


Saves all the settings in this dialog box to a shortcut so that you can conveniently launch the Trayer with the target application by double clicking on the shortcut. The shortcut created will be placed on the desktop by default.


Specifies whether you want Trayer to remember your preference by writing it to the Registry.

Currently only the default folder for saving Trayer shortcuts is supported.


Enter the filename of the target program that you want to run in the system tray. You can even enter a document filename here. Trayer is able to resolve the associated application for to open the document file.


Click here to browse through folders to find the file you want.


Enter the command-line arguments that you want to pass to the target program at startup.


Specifies the folder that contains the original item or some related files. Sometimes, programs need to use files from other locations. You may need to specify the folder where these files are located so that the program can find them.


Click here to browse and find the folder you want.


Specifies how the window is displayed when you start this program. You can display it as a normal window, reduced to a button on the taskbar, or enlarged to take up the whole screen.

If “Minimized” is selected while “Hide Taskbar Button” option is set to "On Minimize", the program will be run as hidden.


If this option is selected, Trayer will automatically resolve and replace the document filename that you entered in the "Filename" field with the associated program. This option does nothing if the filename is already an executable.


Specifies the name of the file that contains the icon to be shown in the system tray.

The same icon will be used for the shortcut created by clicking the “Create Shortcut” button.


Click here to bring up the icon chooser dialog box.


Some icon files contain more than one icon, and you can use this slider to select the icon that you want to be shown in the system tray, or as the icon for the shortcut created by clicking the “Create Shortcut” button.


Specifies the number of clicks to show or to hide the window.


Specifies whether you want to hide the window button on the taskbar when the window is minimized, always hide button or never hide.

Please be informed that the "Always Hide" feature is implemented with the help of system hook, which incurs overheads and degrade slight overall system performance. Therefore, this option is not selected by default.


Specifies whether you want to hide the icon in the system tray automatically when the target window is shown.


Specifies whether you want to update the icon in the system tray automatically when the icon of the target window is updated.

This option is useful for programs that change the window icon to indicate its status.


Specifies the name of the window, also known as caption or window title. You need to enter this option only if you have problem running the target program without entering this.

Example 1: Some applications may open a few windows at a time, resulting Trayer not being able to determine which is the right window to be put in the system tray.

Example 2: Some programs simply execute another program and then terminate itself without opening any window at all. In this case, Trayer detects the termination of the program and displays an error message as below:

Target process has been terminated.

Please use Caption parameter to locate the target window.

One example of these programs is Write.exe, which launches Wordpad.exe.


Specifies whether the string entered in “Window Name/Caption” field is to be matched against the full window caption or partial window caption.

For instance, if there were two windows named “Calculator” and “Scientific Calculator”, you would need to turn this option to YES in order to capture the right window.


Specifies the time Trayer waits for the window of the target application to appear.

If the Trayer cannot locate the window within the given time, Trayer will display an error message and terminate itself.

In case some programs take really long to load, increase this to a higher value.

Please note that this field is in term of millisecond (1/1000 second). For example, enter 15000 for 15 seconds.


To indicate that the main window of the target application itself might be a child window created by a hidden parent window.

Note that Trayer by default detects only visible top level window (which has no parent window). However, you should turn this option on only if Trayer suggested to you to do so.


When this option is selected, Trayer will grab the first window located, which is created by the target program, as the target window.


When this option is selected, Trayer will grab the first window located, which is created by the target program, and all its child windows as the target windows.


When this option is selected, Trayer will grab all the windows created by the target program process (including any existing one) as the target windows.

This option is useful for programs that display a splash screen on startup.

IMPORTANT: Do not use this option on Windows Explorer!!!

This is because Windows Explorer is actually the shell itself (including the taskbar). As such, if you did that and then click and hide the target window, the taskbar and all the desktop icons will be hidden, too, not to mention losing the control of Trayer.


Specifies whether you want Trayer to behave like an Application Launcher.

When this option is selected, Trayer first adds icon to the system tray without launching the target program (unless specified otherwise in "Launch at Startup" option), and launches the target program as and when it is needed, e.g. when the user clicks on the icon in the system tray.

The icon in the system tray remains even if the target program is terminated, so that the user can conveniently click on the icon and launch the target program.


Specifies whether you want to launch the target program as soon as Trayer is executed in Application Launcher mode.


Specifies whether you want to run only a single instance of the target application.

This function can be used in conjunction with the shortcut key defined for the Trayer shortcut, so that you can activate, show or hide the target application by pressing the shortcut key.


Specifies the behaviour of the Exit command in the Trayer context menu.

Exit Trayer Only: Exits Trayer only without terminating the target application.

SC_CLOSE: Sends WM_SYSCOMMAND with SC_CLOSE to the target window. This is equivalent to pressing the Close button on the upper-right corner of the target window.

WM_CLOSE: Sends WM_CLOSE to the target window. This is quite low level and should not be used unless necessary.